package com.shinhye.smartsms.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class GroupOpenHelper extends SQLiteOpenHelper {
	private static GroupOpenHelper mInstance = null;

	public static GroupOpenHelper getInstance(Context context) {
		if(mInstance == null) {
			synchronized(GroupOpenHelper.class) {
				if(mInstance == null) {
					mInstance = new GroupOpenHelper(context, "group.db", null, 1);
				}
			}
		}
		return mInstance;
	}
	
	private GroupOpenHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("create table groups(_id integer primary key autoincrement, name varchar(20))");
		db.execSQL("create table thread_group(_id integer primary key autoincrement, thread_id integer, group_id integer)");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

	}

}
